package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TbFreight;
import com.ruoyi.system.mapper.TbFreightMapper;
import com.ruoyi.system.service.ITbFreightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 运费Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class TbFreightServiceImpl implements ITbFreightService 
{
    @Autowired
    private TbFreightMapper tbFreightMapper;

    /**
     * 查询运费
     * 
     * @param id 运费主键
     * @return 运费
     */
    @Override
    public TbFreight selectTbFreightById(Long id)
    {
        return tbFreightMapper.selectTbFreightById(id);
    }

    /**
     * 查询运费列表
     * 
     * @param tbFreight 运费
     * @return 运费
     */
    @Override
    public List<TbFreight> selectTbFreightList(TbFreight tbFreight)
    {
        return tbFreightMapper.selectTbFreightList(tbFreight);
    }

    /**
     * 新增运费
     * 
     * @param tbFreight 运费
     * @return 结果
     */
    @Override
    public int insertTbFreight(TbFreight tbFreight)
    {
        tbFreight.setCreateTime(DateUtils.getNowDate());
        return tbFreightMapper.insertTbFreight(tbFreight);
    }

    /**
     * 修改运费
     * 
     * @param tbFreight 运费
     * @return 结果
     */
    @Override
    public int updateTbFreight(TbFreight tbFreight)
    {
        tbFreight.setUpdateTime(DateUtils.getNowDate());
        return tbFreightMapper.updateTbFreight(tbFreight);
    }

    /**
     * 批量删除运费
     * 
     * @param ids 需要删除的运费主键
     * @return 结果
     */
    @Override
    public int deleteTbFreightByIds(Long[] ids)
    {
        return tbFreightMapper.deleteTbFreightByIds(ids);
    }

    /**
     * 删除运费信息
     * 
     * @param id 运费主键
     * @return 结果
     */
    @Override
    public int deleteTbFreightById(Long id)
    {
        return tbFreightMapper.deleteTbFreightById(id);
    }
}
